package com.dx.financehy.modules.system.domain.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.dx.financehy.base.CommonDto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

/**
* @author jinjin
* @date 2020-09-25
*/
@Data
public class UserDto extends CommonDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private String id;

    @ApiModelProperty(value = "账号/手机号")
    private String username;

    @JSONField(serialize = false)
    @JsonIgnore
    private String password;

    @ApiModelProperty(value = "状态，是否启用")
    private Boolean enabled;

    @ApiModelProperty(value = "用户类型：1-admin（导师），2-business（商家），3-tourist（游客）")
    private Integer userType;

    @ApiModelProperty(value = "姓名")
    private String name;

    @ApiModelProperty(value = "微信号")
    private String wxOpenId;

    @ApiModelProperty(value = "是否允许登录: 1允许，0不允许")
    private Boolean isLogin;

    @ApiModelProperty(value = "头像真实路径")
    private String avatarPath;

    @ApiModelProperty(value = "商家id")
    private String merchantId;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        UserDto dto = (UserDto) o;
        return Objects.equals(id, dto.id) &&
                Objects.equals(username, dto.username);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, username);
    }

}
